package com.menggudf.controller;

import com.menggudf.model.MedicalRecordModel;
import com.menggudf.model.ResultModel;
import com.menggudf.service.MedicalRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

@Controller
@RequestMapping("medicalRecord")
public class MedicalRecordController {

    @Autowired
    MedicalRecordService medicalRecordService;

    @RequestMapping("getById")
    @ResponseBody
    public MedicalRecordModel getById(
            @RequestParam("id") Integer id){
        return medicalRecordService.getById(id);

    }

    @RequestMapping("/getMedicalRecordList")
    @ResponseBody
    public Map<String, Object> getMedicalRecords(
            @RequestParam(value="userName",required=false) String userName,
            @RequestParam("limit") int pageSize,
            @RequestParam("offset") int offset){
        return medicalRecordService.getMedicalRecordList(userName,pageSize,offset);

    }
}
